cmake_minimum_required(VERSION 3.24)
project(learn_vulkan)

set(CMAKE_CXX_STANDARD 17)

file(COPY texture DESTINATION .)
add_definitions(-DVK_USE_PLATFORM_WIN32_KHR)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(SPIR-V)

find_package(Vulkan REQUIRED)
if(Vulkan_FOUND)
    message("Find vulkan success!")
    include_directories(${Vulkan_INCLUDE_DIRS})
endif()

set(glfw3_DIR "C:/Program Files (x86)/GLFW/lib/cmake/glfw3")
set(glfw3_INCLUDE_DIRS "C:/Program Files (x86)/GLFW/include")
set(glfw3_LIBRARY "C:/Program Files (x86)/GLFW/lib/libglfw3.a")

find_package(glfw3 REQUIRED)
if(glfw3_FOUND)
    message("Find glfw3 success!")
    include_directories(${glfw3_INCLUDE_DIRS})
endif()

add_subdirectory(external/glm)

set(SHADERS
        shaders/demo01.frag
        shaders/demo01.vert
        )
spirv_shaders(
        SHADER_HEADERS
        SPIRV_VERSION
        1.0 # Currently targeting Vulkan 1.0
        SOURCES
        ${SHADERS}
)

add_executable(
        ${PROJECT_NAME}
        external/stb_image/stb_image.h
        src/VulkanCommon.h
        src/Headers.h
        src/Main.cpp
        ${SHADER_HEADERS}
        src/VkBundle.h
        src/VkHelper.cpp
        src/VkHelper.h
        src/Geometry.cpp
        src/Geometry.h
        src/GeometryDemo.h
        src/Texture.cpp
        src/Texture.h
)
target_include_directories(${PROJECT_NAME} PUBLIC "external/stb_image")
target_link_libraries(${PROJECT_NAME} PUBLIC ${Vulkan_LIBRARY} ${glfw3_LIBRARY} glm)